package com.open.capacity.user.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.open.capacity.common.model.Dictionary;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface DictionaryDao extends BaseMapper<Dictionary> {

    /**
     * 查询字典列表条数
     */
    int count(Map<String, Object> params);

    /**
     * 查询字典列表
     * @param params
     * @return
     */
    List<Dictionary> findList(Map<String, Object> params);

    /**
     * 添加字典
     * @param dictionary
     * @return
     */
    int addDictionary(Dictionary dictionary);

    /**
     * 判断字典Code和字典类型是否同时存在
     * @param dccode
     * @param dctype
     * @return
     */
    int isHaveDccode(@Param("dccode")String dccode,@Param("dctype") String dctype);

    @Select("select * from dictionary where dictid=#{dictid}")
    Dictionary findById(Long id);

    int updateDictionaryEnabled(Dictionary dictionary);

    /**
     * 修改字典类型
     * @param dictionary
     * @return
     */
    int updateDictionary(Dictionary dictionary);
}
